<?php

namespace common\models\db\tables;

use Yii;

/**
 * This is the model class for table "{{%files}}".
 *
 * @property int $id
 * @property string $filename
 * @property string $extension
 * @property string $mime_type
 * @property string $relation_path
 * @property string|null $yii_alias_uploads_root
 * @property int $size 文件大小
 * @property int $created_at
 * @property int $updated_at
 * @property string $component_id
 * @property int $type 1图片2视频99其他
 */
class Files extends \yii\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return '{{%files}}';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['filename', 'extension', 'mime_type', 'relation_path', 'yii_alias_uploads_root', 'size', 'created_at', 'updated_at', 'component_id', 'type'], 'trim'],
            [['filename', 'extension', 'mime_type', 'size', 'created_at', 'updated_at', 'component_id'], 'required'],
            [['size', 'created_at', 'updated_at', 'type'], 'integer'],
            [['filename'], 'string', 'max' => 180],
            [['extension'], 'string', 'max' => 25],
            [['mime_type'], 'string', 'max' => 40],
            [['relation_path', 'yii_alias_uploads_root'], 'string', 'max' => 50],
            [['component_id'], 'string', 'max' => 60],
            [['relation_path'], 'default', 'value' => ''],
            [['yii_alias_uploads_root'], 'default', 'value' => null],
            [['type'], 'default', 'value' => 1],
            [['filename'], 'unique'],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => Yii::t('app', 'ID'),
            'filename' => Yii::t('app', 'Filename'),
            'extension' => Yii::t('app', 'Extension'),
            'mime_type' => Yii::t('app', 'Mime Type'),
            'relation_path' => Yii::t('app', 'Relation Path'),
            'yii_alias_uploads_root' => Yii::t('app', 'Yii Alias Uploads Root'),
            'size' => Yii::t('app', '文件大小'),
            'created_at' => Yii::t('app', 'Created At'),
            'updated_at' => Yii::t('app', 'Updated At'),
            'component_id' => Yii::t('app', 'Component ID'),
            'type' => Yii::t('app', '1图片2视频99其他'),
        ];
    }
}
